﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace r2mp_DataStructures
{
    /// <summary>
    /// Contains the data of one task as part of the project.
    /// This can be a task or a milestone.
    /// </summary>
    public class Task
    {

        /// <summary>
        /// Name of the task or milestone.
        /// </summary>
        private String name;

        /// <summary>
        /// Internal number of the milestone. The number consists of non-decimal positive numbers separated by points.
        /// The number of numbers is the amount of layers down the task is inside the task-hirarchy.
        /// </summary>
        private String nr;

        /// <summary>
        /// Defines how many working-hours are left on a phase and also serves to differ between milestones or phases.
        /// Phases have at least 0 working-hours. Milestones always have a value of -1.
        /// </summary>
        private int duration;

        /// <summary>
        /// Defines if the task has been started, finished or is still pending to be started.
        /// </summary>
        private int status;

        /// <summary>
        /// Is a collection of all tasks which are child-tasks of this task. They are one level lower in the task-hirarchy.
        /// </summary>
        private List<Task> tasks;

        /// <summary>
        /// Is a collection of the names of all necessary ressources for this task.
        /// </summary>
        private List<String> ressources = new List<String>();
        public List<String> Ressources
        {
            get { return ressources; }
            set { ressources = value; }
        }

        public const int Milestone = 0;
        public const int Phase = -1;

        public const int Pending = 0;
        public const int Started = 1;
        public const int Finished = 2;
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public string Nr
        {
            get { return nr; }
            set { nr = value; }
        }

        public int Duration
        {
            get { return duration; }
            set { duration = value; }
        }

        public int Status
        {
            get { return status; }
            set { status = value; }
        }

        public List<Task> Tasks
        {
            get { return tasks; }
            set { tasks = value; }
        }

        public Task()
        {
            tasks = new List<Task>();
        }

        public Task(String name, String nr, int duration, int status)
        {
            this.name = name;
            this.nr = nr;
            this.duration = duration;
            tasks = new List<Task>();
            this.status = status;
        }
    }
}
